﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using  System.Data.SqlClient;
using TrainingWorkshop.IDAL;
using TrainingWorkshop.DALFactory;
using TrainingWorkshop.DAL_SQL;
using System.Configuration;

namespace TrainingWorkshop.DALFactory
{
    public class SqlFactory:IFactory
    {

        /// <summary>
        /// Sql Connection
        /// </summary>
        private SqlConnection _conn;

        /// <summary>
        /// getter and setter of Conn
        /// </summary>
        public SqlConnection Conn
        {
            get { return _conn; }
            set { _conn = value; }
        }
        /// <summary>
        /// Constructor
        /// no parameter
        /// </summary>
        public SqlFactory() {
            this.Conn = new SqlConnection(ConfigurationManager.ConnectionStrings["projectbConnection"].ConnectionString);
        }
        public ITeacherRepository CreateTeacherRepository()
        {
            return new TeacherRepository_Sql(this.Conn);
        }
        public ILevelRepository CreateLevelRepository()
        {
            return new LevelRepository_Sql(this.Conn);
        }
        public ICourseListRepository CreateCourseListRepository()
        {
            return new CourseListRepository_Sql(this.Conn);
        }



        public IStudentRepository CreateStudentRepository()
        {
            throw new NotImplementedException();
        }


        public ICourseRepository CreateCourseRepository()
        {
            throw new NotImplementedException();
        }


        public ICourseDetailRepository CreateCourseDetailRepository()
        {
            throw new NotImplementedException();
        }
    }
}
